cmake_minimum_required (VERSION 3.9)
project (yht)

set(TARGETPATFORM "arm")
set(ARMPATHLIB  "/opt/rk3506/sysroot/usr/lib")
set(ARMPATHINCLUDE  "/opt/rk3506/sysroot/usr/include" )

#set(CMAKE_FORCE_C_COMPILER "/opt/rk3506/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-gcc")
#set(CMAKE_FORCE_CXX_COMPILER "/opt/rk3506/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-g++")

#set(CMAKE_C_COMPILER_FORCED ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_AUTOMOC ON)
if(WIN32)
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")   # 设置可执行文件的输出目录
else()
    set(CMAKE_CXX_VISIBILITY_PRESET hidden)
    set(CMAKE_C_VISIBILITY_PRESET hidden)
    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
    set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")   # 设置可执行文件的输出目录
endif()

# windows 并行编译选项
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/Gm->) #高版本已被废弃，但是低版本的Gm会影响并行
cmake_host_system_information(RESULT CPU_NUMBER_OF_LOGICAL_CORES QUERY NUMBER_OF_LOGICAL_CORES)
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/MP${CPU_NUMBER_OF_LOGICAL_CORES}>)



add_definitions(-D_CRT_SECURE_NO_WARNINGS -DAF_CLASSARRANGE_EXPORTS)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -utf-8")
    if(WIN32)
        set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
    set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG:FULL /OPT:REF /OPT:ICF")
    set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG:FULL /OPT:REF /OPT:ICF")
    endif()

# 设置中文翻译
# set(TRANS_DIR "${CMAKE_BINARY_DIR}/translate")
# set(TS_FILE "${TRANS_DIR}/mibt_zh_CN.ts")

# find_program(LUPDATE_EXECUTABLE lupdate)
# find_program(LRELEASE_EXECUTABLE lrelease)

# foreach(_chinese_file ${TS_FILE})
# 	execute_process(
# 		COMMAND ${LUPDATE_EXECUTABLE} -recursive ${CMAKE_SOURCE_DIR} -ts ${_chinese_file}
# 	)
# 	execute_process(
# 		COMMAND ${LRELEASE_EXECUTABLE} ${_chinese_file}
# 	)
# endforeach()

if(TARGETPATFORM MATCHES "arm")
    message(STATUS "Detected ARM architecture")

    include_directories(${ARMPATHINCLUDE})
endif()

add_subdirectory(ThirdParty/spdlog)
# add_subdirectory(ThirdParty/xlsx)
# add_subdirectory(ThirdParty/googletest)
add_subdirectory(ThirdParty/geographiclib)
add_subdirectory(CommonUtils)
add_subdirectory(ThirdParty/quazip)
add_subdirectory(IEC61162)
# add_subdirectory(dbapp)
# add_subdirectory(EhhBll)

# add_subdirectory(htzbase)
add_subdirectory(yht)


